package com.leenmvc.core.utils.spring;

import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * 当前工程的applicationContext上下文
 */
@Component
public class Spring implements ApplicationContextAware {

    public static AnnotationConfigServletWebServerApplicationContext APP;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) {
        if(Spring.APP == null) {
            Spring.APP = (AnnotationConfigServletWebServerApplicationContext) applicationContext;
        }
    }

}